package com.common.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
@Accessors(chain = true)
@ApiModel(description = "基础字段")
public class BaseEntity implements Serializable {

    /**
     * 实体编号（唯一标识）
     */
//    @TableField()
    @TableId(type = IdType.ASSIGN_UUID)
    protected String id;

    @ApiModelProperty(value = "创建人")
    private String createUserId;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    private String updateUserId;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "机构ID")
    private String orgid;

    @ApiModelProperty(value = "园区ID")
    private String operId;

    @ApiModelProperty(value = "删除标识(启用标志，0启用，1停用)")
    @TableLogic
    private Integer stateSign;

//
//    @ApiModelProperty(value = "创建者")
//    protected String createBy;
//
//    @ApiModelProperty(value = "创建时间")
//    protected Date createDate;
//
//    @ApiModelProperty(value = "更新者")
//    protected String updateBy;
//
//    @ApiModelProperty(value = "更新时间")
//    protected Date updateDate;
//
//    @ApiModelProperty(value = "删除标记")
//    @TableLogic
//    protected Integer delFlag;

    /**
     * 自定义SQL（SQL标识，SQL内容）
     */
    @TableField(exist = false)
    protected transient Map<String, String> sqlMap = new HashMap<>();

    //因要和trantor平台交互需要跳过权限，需要判断此字段是否为空跳过权限
    @TableField(exist = false)
    private String trantorId;

    //因要和trantor平台交互需要跳过权限，需要判断此字段是否为空跳过权限
    @TableField(exist = false)
    private String aiotId;


}
